local skel = fk.CreateSkill{
    name = "ling__zuoyoufengyuan",
}

Fk:loadTranslationTable{
    ["ling__zuoyoufengyuan"] = "左右逢源",
    [":ling__zuoyoufengyuan"] = "其他角色对你使用【杀】时，你可以选择一项：获得其一张牌，然后本回合你不能使用牌；交给其一张牌，然后本回合其不能再对你使用牌。",

    ["#ling__zuoyoufengyuan-invoke"] = "左右逢源：你可以选择获得或交给目标一张牌",

    ["#ling__zuoyoufengyuan-left"] = "左右逢源：你可以选择获得目标一张牌，然后本回合你不能使用牌",
    ["#ling__zuoyoufengyuan-right"] = "左右逢源：你可以选择交给目标一张牌，然后本回合其不能再对你使用牌",
    ["#ling__zuoyoufengyuan-give"] = "左右逢源：你可以选择交给 %dest 一张牌，然后本回合其不能再对你使用牌",
}

skel:addEffect(fk.TargetConfirmed, {
    anim_type = "defensive",
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(skel.name) and data.from and data.from ~= player 
      and data.card and data.card.trueName == "slash"
    end,
    on_cost = function(self, event, target, player, data)
       local choice = player.room:askToChoice(player, {
        skill_name = skel.name,
        choices = {"#ling__zuoyoufengyuan-left", "#ling__zuoyoufengyuan-right","Cancel"},
        prompt = "#ling__zuoyoufengyuan-invoke",
      })
      if choice ~= "Cancel" then
        event:setCostData(self, choice)
        return true
      end
      return false
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local choice = event:getCostData(self)
        if choice == "#ling__zuoyoufengyuan-left" then
            local card = room:askToChooseCard(player, {
                target = data.from,
                flag = "he",
                skill_name = skel.name,
              })
              room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonPrey, skel.name, nil, false, player)
              room:addTableMark(player, "ling__zuoyoufengyuan_left-turn", player.id)
        elseif choice == "#ling__zuoyoufengyuan-right" then
            local card = room:askForCard(player, 1, 1, true, skel.name, false, nil, "#ling__zuoyoufengyuan-give::"..data.from.id)
            room:moveCardTo(card, Card.PlayerHand, data.from, fk.ReasonGive, skel.name, nil, false, player.id)
            room:addTableMark(data.from, "ling__zuoyoufengyuan_right-turn", player.id)
        end
    end,
  })


skel:addEffect("prohibit", {
    is_prohibited = function(self, from, to, card)
      if from then
       if to then
         return table.contains(from:getTableMark("ling__zuoyoufengyuan_left-turn"), to.id)
       end
      end

    end,
  })


  skel:addEffect("prohibit", {
    is_prohibited = function(self, from, to, card)
      if from then
        return table.contains(from:getTableMark("ling__zuoyoufengyuan_left-turn"), from.id)
      end

    end,
  })



return skel